package ollama

import "context"

type Options func(o *option)

type option struct {
	ctx           context.Context
	Url           string `json:"url"`           // default: http://localhost:11434
	Path          string `json:"path"`          // default: ./ollama  or use `which` find ollama
	CacheFilePath string `json:"cacheFilePath"` // default: ./ollama_cache
}

func WithContext(ctx context.Context) Options {
	return func(o *option) {
		o.ctx = ctx
	}
}

func WithUrl(url string) Options {
	return func(o *option) {
		if url != "" {
			o.Url = url
		}
	}
}

func WithBin(path string) Options {
	return func(o *option) {
		if path != "" {
			o.Path = path
		}
	}
}

func WithCacheFilePath(cacheFilePath string) Options {
	return func(o *option) {
		if cacheFilePath != "" {
			o.CacheFilePath = cacheFilePath
		}
	}
}
